﻿<%@ Page Language="C#" Theme="WebMaster" MasterPageFile="~/WebMaster/MasterPage.master"
    AutoEventWireup="true" Inherits="SouthernLand.WebMaster.Advertise.Default" CodeBehind="Default.aspx.cs" %>

<%@ Register Src="~/WebMaster/Controls/Title.ascx" TagName="Title" TagPrefix="uc" %>
<%@ Register TagPrefix="southern" Namespace="SouthernLand.Common.BOL.Advertise" Assembly="SouthernLand" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" runat="Server">
    <uc:Title runat="server" ResourceKey='Logo_LogoManager' />
    <asp:UpdatePanel ID="UpdatePanelContactPersons" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
        </ContentTemplate>
    </asp:UpdatePanel>
    <table align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <table width="100%">
                    <tr>
                        <td width="50%" align="left">
                            <a href="<%=Globals.ApplicationPath %>WebMaster/Advertise/AdvertiseAdd.aspx" class="linkAdd">
                                Thêm Quảng cáo mới </a>
                        </td>
                        <td width="50%" align="right">
                            <b>
                                <%=ResourceManager.GetString("Logo_Position") %>: </b>
                            <southern:ddlposition runat="server" id="dlPosition" cssclass="Textbox" />
                            <asp:Button ID="btSearch" runat="server" Text="Search" OnClick="btSearch_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center">
                <br />
                <asp:GridView runat="server" ID="GridViewItem" Width="700" DataSourceID="ObjectDataSource"
                    AutoGenerateColumns="false" DataKeyNames="AdvID" PagerSettings-Mode="NumericFirstLast"
                    PageSize="25">
                    <Columns>
                        <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                            HeaderText="Delete">
                            <HeaderTemplate>
                                <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
                                    type="checkbox" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox runat="server" ID="chkSelect" ToolTip='<%# Eval("AdvID") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Hình ảnh" HeaderStyle-Width="130" ItemStyle-Width="130"
                            HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="center">
                            <ItemTemplate>
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td align="center" valign="middle">
                                            <a href="<%#Eval("AdvURL")%>" target="_blank">
                                                <%# GetAdvertise((string)Eval("FileName"), (int)Eval("AdvWidth"), (int)Eval("AdvHeight"))%>
                                            </a>
                                        </td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Địa chỉ Liên kết" HeaderStyle-HorizontalAlign="left"
                            ItemStyle-HorizontalAlign="left">
                            <ItemTemplate>
                                <%# Eval("AdvUrl")%></ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                            ItemStyle-Width="60" HeaderStyle-Width="60">
                            <HeaderTemplate>
                                Width</HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("AdvWidth")%></ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                            ItemStyle-Width="60" HeaderStyle-Width="60">
                            <HeaderTemplate>
                                Height</HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("AdvHeight")%></ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                            ItemStyle-Width="40" HeaderStyle-Width="40" HeaderText="Edit">
                            <HeaderTemplate>
                                <%=ResourceManager.GetString("Edit") %></HeaderTemplate>
                            <ItemTemplate>
                                <a href="AdvertiseAdd.aspx?AdvID=<%# Eval("AdvID")%>&Action=Edit">
                                    <img src="<%=Globals.ImagesUrlWebMaster()%>Edit.gif" border="0" />
                                </a>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <table align="center" width="300" border="0" bordercolorlight="#0099cc" bordercolor="#0099cc">
                            <tr>
                                <td height="50" align="center">
                                    <div align="center" id="EmptyData">
                                        <%=ResourceManager.GetString("DataEmpty") %></div>
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="left" width="100%" style="padding-top: 15px;">
                <asp:Button runat="server" ID="btDelete" Text="Delete" OnClick="btDelete_Click" />
            </td>
        </tr>
    </table>
    <br />
    <br />
    <br />
    <br />
    <asp:ObjectDataSource ID="ObjectDataSource" runat="server" SelectMethod="GetAllAdvertise"
        TypeName="SouthernLand.Common.BOL.Advertise.Advertise"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="SearchDataSource" runat="server" SelectMethod="GetAdvertiseByPosition"
        TypeName="SouthernLand.Common.BOL.Advertise.Advertise">
        <SelectParameters>
            <asp:ControlParameter ControlID="dlPosition" Name="AdvPosition" PropertyName="SelectedValue"
                Type="int32" DefaultValue="-1" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
